package com.hrc.springboot.listener;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplicationRunListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

public class HelloSpringApplicationRunListener implements SpringApplicationRunListener {

    public HelloSpringApplicationRunListener(SpringApplication springApplication, String[] args) {
    }

    @Override
    public void starting() {
        System.out.println("1.SpringApplicationRunListener... starting");
    }

    @Override
    public void environmentPrepared(ConfigurableEnvironment environment) {
        Object o = environment.getSystemProperties().get("os.name");
        System.out.println("2.SpringApplicationRunListener... ConfigurableEnvironment:::::>>>>>" + o);
    }

    @Override
    public void contextPrepared(ConfigurableApplicationContext context) {
        System.out.println("3.SpringApplicationRunListener... contextPrepare");
    }

    @Override
    public void contextLoaded(ConfigurableApplicationContext context) {
        System.out.println("4.SpringApplicationRunListener... contextLoaded");
    }

    @Override
    public void started(ConfigurableApplicationContext context) {
        System.out.println("5.SpringApplicationRunListener... started");
    }

    @Override
    public void running(ConfigurableApplicationContext context) {
        System.out.println("6.SpringApplicationRunListener... running");
    }

    @Override
    public void failed(ConfigurableApplicationContext context, Throwable exception) {

    }
}
